package com.yootk.main;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.convert.support.ConfigurableConversionService;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.StandardEnvironment;

/**
 * ConversionService数据转换服务
 */
public class Demo06_ConversionService {
    private static final Logger LOGGER = LoggerFactory.getLogger(Demo06_ConversionService.class);

    public static void main(String[] args) {
        test1();
    }

    /**
     * 实现数据的转换处理
     */
    public static void test1() {
        ConfigurableEnvironment environment = new StandardEnvironment();
        ConfigurableConversionService conversionService = environment.getConversionService();
        double num = conversionService.convert("6.5", Double.class);
        LOGGER.info("数据转换后的数学计算：{}", num * 2);
    }
}
